﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Role_Power_Default : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strPage = Request["page"];
            int page = 1;
            try
            {
                page = int.Parse(strPage);
                if (page < 1)
                {
                    page = 1;
                }
            }
            catch (Exception ex)
            {
                page = 1;
            }
            db(page);
        }
    }
    void db(int page)
    {
        CMSModel.CMSEntities dal = DAL.DBManager.GetCmsEmtity();
        var role_power = dal.Role_Power.AsQueryable();
        AspNetPager1.RecordCount = role_power.Count();
        AspNetPager1.CurrentPageIndex = page;
        role_power = role_power.OrderBy(x => "id").Skip((page - 1) * AspNetPager1.PageSize).Take(AspNetPager1.PageSize);
        Repeater1.DataSource = role_power;
        Repeater1.DataBind();
    }
    public int GetPage()
    {
        return AspNetPager1.CurrentPageIndex;
    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        db(AspNetPager1.CurrentPageIndex);
    }
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        db(AspNetPager1.CurrentPageIndex);
    }
}